%*--------------------- MODULATORS LOOKUP TABLES -------------------------%

%       Data Rate   |  Modulation
%          (bps)    |
%                   |
%         3200      |    QPSK
%         4800      |    8PSK
%         6400      |    16QAM
%         8000      |    32QAM
%         9600      |    64QAM
%        12800     |    64QAM

%*------------------------------------------------------------------------%
clear

% %*------------------- QPSK (3200 bps)-----------------------------------%
% 
LUT_PSK_Q_4(1) = 1        + j*0 ;
LUT_PSK_Q_4(2) = 0        + j*1 ;
LUT_PSK_Q_4(3) =-1        + j*0 ;
LUT_PSK_Q_4(4) = 0        - j*1 ;
% 
LUT_PSK_Q_41 = LUT_PSK_Q_4;
save LUT_PSK_Q_4 LUT_PSK_Q_4
% %*------------------------------------------------------------------------%

%*------------------- QPSK (3200 bps)& 8PSK (4800 bps)--------------------%

LUT_PSK_Q_8(1) = 1        + j*0 ;
LUT_PSK_Q_8(2) = 0.707107 + j*0.707107 ;
LUT_PSK_Q_8(3) = 0        + j*1 ;
LUT_PSK_Q_8(4) =-0.707107 + j*0.707107 ;
LUT_PSK_Q_8(5) =-1        + j*0 ;
LUT_PSK_Q_8(6) =-0.707107 - j*0.707107 ;
LUT_PSK_Q_8(7) = 0        - j*1 ;
LUT_PSK_Q_8(8) = 0.707107 - j*0.707107 ;

% Power_Factor_PSK_Q_8 = LUT_PSK_Q_8*LUT_PSK_Q_8';
% LUT_PSK_Q_8 = LUT_PSK_Q_8/sqrt(Power_Factor_PSK_Q_8 );
LUT_PSK_Q_81 = LUT_PSK_Q_8;
save LUT_PSK_Q_8 LUT_PSK_Q_8
%*------------------------------------------------------------------------%

%*-------------------------- 16QAM (6400 bps)-----------------------------%

LUT_QAM_16(1) = 0.866025 + j*0.5 ;
LUT_QAM_16(2) = 0.5      + j*0.866025 ;
LUT_QAM_16(3) = 1        + j*0 ;
LUT_QAM_16(4) = 0.258819 + j*0.258819 ;
LUT_QAM_16(5) =-0.5      + j*0.866025 ;
LUT_QAM_16(6) = 0        + j*1 ;
LUT_QAM_16(7) =-0.866025 + j*0.5 ;
LUT_QAM_16(8) =-0.258819 + j*0.258819 ;
LUT_QAM_16(9) = 0.5      - j*0.866025 ;
LUT_QAM_16(10)= 0        - j*1 ;
LUT_QAM_16(11)= 0.866025 - j*0.5 ;
LUT_QAM_16(12)= 0.258819 - j*0.258819 ;
LUT_QAM_16(13)=-0.866025 - j*0.5 ;
LUT_QAM_16(14)=-0.5      - j*0.866025 ;
LUT_QAM_16(15)=-1        + j*0 ;
LUT_QAM_16(16)=-0.258819 - j*0.258819 ;

% Power_Factor_QAM_16 = LUT_QAM_16*LUT_QAM_16';
% LUT_QAM_16= LUT_QAM_16/sqrt(Power_Factor_QAM_16);
LUT_QAM_161=LUT_QAM_16;
save LUT_QAM_16 LUT_QAM_16
%*------------------------------------------------------------------------%

%*----------------------- 32QAM (8000 bps) -------------------------------%

LUT_QAM_32(1)  = 0.866380 + j*0.499386 ;
LUT_QAM_32(2)  = 0.984849 + j*0.173415 ;
LUT_QAM_32(3)  = 0.499386 + j*0.866380 ;
LUT_QAM_32(4)  = 0.173415 + j*0.984849 ;
LUT_QAM_32(5)  = 0.520246 + j*0.520246 ;
LUT_QAM_32(6)  = 0.520246 + j*0.173415 ;
LUT_QAM_32(7)  = 0.173415 + j*0.520246 ;
LUT_QAM_32(8)  = 0.173415 + j*0.173415 ;
LUT_QAM_32(9)  =-0.866380 + j*0.499386 ;
LUT_QAM_32(10) =-0.984849 + j*0.173415 ;
LUT_QAM_32(11) =-0.499386 + j*0.866380 ;
LUT_QAM_32(12) =-0.173415 + j*0.984849 ;
LUT_QAM_32(13) =-0.520246 + j*0.520246 ;
LUT_QAM_32(14) =-0.520246 + j*0.173415 ;
LUT_QAM_32(15) =-0.173415 + j*0.520246 ;
LUT_QAM_32(16) =-0.173415 + j*0.173415 ;
LUT_QAM_32(17) = 0.866380 - j*0.499386 ;
LUT_QAM_32(18) = 0.984849 - j*0.173415 ;
LUT_QAM_32(19) = 0.499386 - j*0.866380 ;
LUT_QAM_32(20) = 0.173415 - j*0.984849 ;
LUT_QAM_32(21) = 0.520246 - j*0.520246 ;
LUT_QAM_32(22) = 0.520246 - j*0.173415 ;
LUT_QAM_32(23) = 0.173415 - j*0.520246 ;
LUT_QAM_32(24) = 0.173415 - j*0.173415 ;
LUT_QAM_32(25) =-0.866380 - j*0.499386 ;
LUT_QAM_32(26) =-0.984849 - j*0.173415 ;
LUT_QAM_32(27) =-0.499386 - j*0.866380 ;
LUT_QAM_32(28) =-0.173415 - j*0.984849 ;
LUT_QAM_32(29) =-0.520246 - j*0.520246 ;
LUT_QAM_32(30) =-0.520246 - j*0.173415 ;
LUT_QAM_32(31) =-0.173415 - j*0.520246 ;
LUT_QAM_32(32) =-0.173415 - j*0.173415 ;

% Power_Factor_QAM_32 = LUT_QAM_32*LUT_QAM_32';
% LUT_QAM_32= LUT_QAM_32/sqrt(Power_Factor_QAM_32);
LUT_QAM_321 = LUT_QAM_32;
save LUT_QAM_32 LUT_QAM_32
%*------------------------------------------------------------------------%

%*---------------------- 64QAM (9600 - 12800 bps) ------------------------%

LUT_QAM_64(1)  = 1.000000 + j*0.000000;
LUT_QAM_64(2)  = 0.822878 + j*0.568218;
LUT_QAM_64(3)  = 0.821137 + j*0.152996;
LUT_QAM_64(4)  = 0.932897 + j*0.360142;
LUT_QAM_64(5)  = 0.000000 - j*1.000000;
LUT_QAM_64(6)  = 0.822878 - j*0.568218;
LUT_QAM_64(7)  = 0.821137 - j*0.152996;
LUT_QAM_64(8)  = 0.932897 - j*0.360142;
LUT_QAM_64(9)  = 0.568218 + j*0.822878;
LUT_QAM_64(10) = 0.588429 + j*0.588429;
LUT_QAM_64(11) = 0.588429 + j*0.117686;
LUT_QAM_64(12) = 0.588429 + j*0.353057;
LUT_QAM_64(13) = 0.568218 - j*0.822878;
LUT_QAM_64(14) = 0.588429 - j*0.588429;
LUT_QAM_64(15) = 0.588429 - j*0.117686;
LUT_QAM_64(16) = 0.588429 - j*0.353057;
LUT_QAM_64(17) = 0.152996 + j*0.821137;
LUT_QAM_64(18) = 0.117686 + j*0.588429;
LUT_QAM_64(19) = 0.117686 + j*0.117686;
LUT_QAM_64(20) = 0.117686 + j*0.353057;
LUT_QAM_64(21) = 0.152996 - j*0.821137;
LUT_QAM_64(22) = 0.117686 - j*0.588429;
LUT_QAM_64(23) = 0.117686 - j*0.117686;
LUT_QAM_64(24) = 0.117686 - j*0.353057;
LUT_QAM_64(25) = 0.360142 + j*0.932897;
LUT_QAM_64(26) = 0.353057 + j*0.588429;
LUT_QAM_64(27) = 0.353057 + j*0.117686;
LUT_QAM_64(28) = 0.353057 + j*0.353057;
LUT_QAM_64(29) = 0.360142 - j*0.932897;
LUT_QAM_64(30) = 0.353057 - j*0.588429;
LUT_QAM_64(31) = 0.353057 - j*0.117686;
LUT_QAM_64(32) = 0.353057 - j*0.353057;

LUT_QAM_64(33) = 0.000000 + j*1.000000;
LUT_QAM_64(34) =-0.822878 + j*0.568218;
LUT_QAM_64(35) =-0.821137 + j*0.152996;
LUT_QAM_64(36) =-0.932897 + j*0.360142;
LUT_QAM_64(37) =-1.000000 + j*0.000000;
LUT_QAM_64(38) =-0.822878 - j*0.568218;
LUT_QAM_64(39) =-0.821137 - j*0.152996;
LUT_QAM_64(40) =-0.932897 - j*0.360142;
LUT_QAM_64(41) =-0.568218 + j*0.822878;
LUT_QAM_64(42) =-0.588429 + j*0.588429;
LUT_QAM_64(43) =-0.588429 + j*0.117686;
LUT_QAM_64(44) =-0.588429 + j*0.353057;
LUT_QAM_64(45) =-0.568218 - j*0.822878;
LUT_QAM_64(46) =-0.588429 - j*0.588429;
LUT_QAM_64(47) =-0.588429 - j*0.117686;
LUT_QAM_64(48) =-0.588429 - j*0.353057;
LUT_QAM_64(49) =-0.152996 + j*0.821137;
LUT_QAM_64(50) =-0.117686 + j*0.588429;
LUT_QAM_64(51) =-0.117686 + j*0.117686;
LUT_QAM_64(52) =-0.117686 + j*0.353057;
LUT_QAM_64(53) =-0.152996 - j*0.821137;
LUT_QAM_64(54) =-0.117686 - j*0.588429;
LUT_QAM_64(55) =-0.117686 - j*0.117686;
LUT_QAM_64(56) =-0.117686 - j*0.353057;
LUT_QAM_64(57) =-0.360142 + j*0.932897;
LUT_QAM_64(58) =-0.353057 + j*0.588429;
LUT_QAM_64(59) =-0.353057 + j*0.117686;
LUT_QAM_64(60) =-0.353057 + j*0.353057;
LUT_QAM_64(61) =-0.360142 - j*0.932897;
LUT_QAM_64(62) =-0.353057 - j*0.588429;
LUT_QAM_64(63) =-0.353057 - j*0.117686;
LUT_QAM_64(64) =-0.353057 - j*0.353057;

% Power_Factor_QAM_64 = LUT_QAM_64*LUT_QAM_64';
% LUT_QAM_64= LUT_QAM_64/sqrt(Power_Factor_QAM_64);
LUT_QAM_641 = LUT_QAM_64;
save LUT_QAM_64 LUT_QAM_64
%*------------------------------------------------------------------------%